
<!-- 增加页面开始 -->


[#macro orderitemAddView]
    <div  class="model-form">
        <el-page-header @back="goBack" content="增加">
        </el-page-header>
        <div class="model-content">
            <el-form ref="ruleForm" :rules="rules" :model="form" label-width="160px" >
                <el-row :gutter="10">
 <el-col :span="12">
     <el-form-item label="购买数量" size="mini" prop="size">
             <el-input v-model="form.size" name="size">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="退货数量" size="mini" prop="returnNum">
             <el-input v-model="form.returnNum" name="returnNum">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="退款金额" size="mini" prop="returnAmount">
             <el-input v-model="form.returnAmount" name="returnAmount">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="售后状态" size="mini" prop="refundState">
             <el-input v-model="form.refundState" name="refundState">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="单位" size="mini" prop="unit">
             <el-input v-model="form.unit" name="unit">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="重量" size="mini" prop="weight">
             <el-input v-model="form.weight" name="weight">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="单价" size="mini" prop="price">
             <el-input v-model="form.price" name="price">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="成交单价" size="mini" prop="realPrice">
             <el-input v-model="form.realPrice" name="realPrice">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="运费" size="mini" prop="freight">
             <el-input v-model="form.freight" name="freight">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="小计" size="mini" prop="subtotal">
             <el-input v-model="form.subtotal" name="subtotal">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="优惠金额" size="mini" prop="discountAmount">
             <el-input v-model="form.discountAmount" name="discountAmount">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="平台优惠" size="mini" prop="platformDiscount">
             <el-input v-model="form.platformDiscount" name="platformDiscount">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="积分抵扣" size="mini" prop="integralDiscount">
             <el-input v-model="form.integralDiscount" name="integralDiscount">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="使用积分" size="mini" prop="useIntegral">
             <el-input v-model="form.useIntegral" name="useIntegral">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="使用红包" size="mini" prop="useRedPacket">
             <el-input v-model="form.useRedPacket" name="useRedPacket">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="单件商品红包抵扣" size="mini" prop="redPacketDiscount">
             <el-input v-model="form.redPacketDiscount" name="redPacketDiscount">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="实际成交金额" size="mini" prop="realAmount">
             <el-input v-model="form.realAmount" name="realAmount">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="已经支付" size="mini" prop="paidAmount">
             <el-input v-model="form.paidAmount" name="paidAmount">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="实际用户支付金额" size="mini" prop="payAmount">
             <el-input v-model="form.payAmount" name="payAmount">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="是否是赠品" size="mini" prop="giveType">
             <el-input v-model="form.giveType" name="giveType">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="商品sku" size="mini" prop="skuAttr">
             <el-input v-model="form.skuAttr" name="skuAttr">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="商品名称" size="mini" prop="name">
             <el-input v-model="form.name" name="name">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="商品封面" size="mini" prop="logo">
             <el-input v-model="form.logo" name="logo">
             </el-input>
     </el-form-item>
      
 </el-col>
                </el-row>
               <el-row>
                    <el-col :span="24"  style="text-align: right;padding-bottom: 20px;padding-top: 20px;">
                        <el-button @click="goBack">取消</el-button>
                        <el-button type="primary" @click="add">确定</el-button>
                    </el-col>
			    </el-row>
            </el-form>
        </div>
    </div>
[/#macro]

[#macro orderitemAddConfig]
<script type="text/x-template" id="my-orderitem-add">
	[@orderitemAddView /]
</script>
<script type="text/javascript">
		//添加组件开始
		var orderitemAddConfig = {};
		orderitemAddConfig.template = "#my-orderitem-add";
		orderitemAddConfig.methods = config.basicMethod();
		orderitemAddConfig.data = function () {
			return {
				form: {
					size: '',
					returnNum: '',
					returnAmount: '',
					refundState: '',
					unit: '',
					weight: '',
					price: '',
					realPrice: '',
					freight: '',
					subtotal: '',
					discountAmount: '',
					platformDiscount: '',
					integralDiscount: '',
					useIntegral: '',
					useRedPacket: '',
					redPacketDiscount: '',
					realAmount: '',
					paidAmount: '',
					payAmount: '',
					giveType: '',
					skuAttr: '',
					name: '',
					logo: ''				},
				rules: {
				}
			}
		};
		orderitemAddConfig.mounted = function () {
		}
		orderitemAddConfig.computed = {};


		orderitemAddConfig.methods.add = function () {
			var self = this;
			this.$refs["ruleForm"].validate(function(valid){
				if (valid) {
					self.addData();
				} else {
					console.log('error submit!!');
					return false;
				}
			});
		}

		orderitemAddConfig.methods.addData = function () {
			var self = this, data = this.form;
			if (this.deforeAddData) {
				this.deforeAddData();
			}
			this.postData("${siteurl}tenantRest/orderitem/create.htm", data, function (res) {
				if (res.code == 0) {
					self.$message({
						message: '添加数据成功',
						type: 'success'
					});
					self.$router.go(-1);
				} else {
					self.$message.error(res.msg);
				}
			});
		}

        orderitemAddConfig.destroyed = function () {
            console.log("destroyed add view ");
            
	    }
		var  orderitemAddView = Vue.component('add-view', orderitemAddConfig);


</script>
[/#macro]

<!-- 增加页面结束 -->